﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LituoPro.util
{

   /**
    * 转换工具类
    */
    public class ConvertUtil
    {

        /**
         * 16进制字节数组转字符串
         */
        public static string ConvertToString(Byte[] bytes)
        {
            string ret = string.Empty;
            if (bytes != null && bytes.Length > 0)
            {
                foreach (byte b in bytes)
                {
                    ret = ret + b;  
                }
            }
            return ret;
        }

        public static string ConvertToHexString(Byte[] bytes)
        {
            string ret = string.Empty;
            if (bytes != null && bytes.Length > 0)
            {
                foreach (byte b in bytes)
                {
                    string hexStr = b.ToString("x2");
                    ret = ret + hexStr;
                }
            }
            return ret;
        }


    }
}
